package com.fortest;

import java.math.BigInteger;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class test4 {
    public static void main(String[] args) throws ParseException {
//        Timestamp timestamp=new Timestamp(System.currentTimeMillis());
//        System.out.println(timestamp);
//        System.out.println(timestamp.getTime());
//        SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd hh:mm");
//        System.out.println(df.format(timestamp));
        String time1="1970-01-01 15:00";
        String time2="2021-01-01 15:01";
        SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd hh:mm");
        Timestamp timestamp1=new Timestamp(df.parse(time1).getTime());
        Timestamp timestamp2=new Timestamp(df.parse(time2).getTime());
        Timestamp timestamp3=new Timestamp(System.currentTimeMillis());
        String str1=df.format(timestamp1.getTime());
        System.out.println(timestamp1);
        System.out.println(df.format(timestamp2.getTime()));
        String timestamp3_str=String.valueOf(timestamp3);
        System.out.println(timestamp3_str.substring(0,timestamp3_str.length()-7));
    }
}
